package cz.muni.fi.pa165.musiclibrary.musiclibraryweb.pages.search;

import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.CssResourceReference;

import cz.muni.fi.pa165.musiclibrary.musiclibraryweb.components.SearchForm;
import cz.muni.fi.pa165.musiclibrary.musiclibraryweb.pages.AbstractMusicLibraryPage;

/**
 * Home page of this application. 
 * Presents search field to user.
 * 
 * @author Maros Kucbel
 * @date 2012-11-21T19:57:42+0100
 */
public final class SearchPage extends AbstractMusicLibraryPage {

    /**
     * Constructor.
     */
    public SearchPage() {
        this(new PageParameters());
    }
    
    /**
     * Constructor
     * @param pageParameters Parameters for page initialization.
     */
    public SearchPage(final PageParameters pageParameters) {
        super(pageParameters);
    }

    @Override
    public void renderHead(IHeaderResponse response) {
        // add css for this page
        response.render(CssHeaderItem.forReference(new CssResourceReference(SearchPage.class, "SearchPage.css")));
        super.renderHead(response);
    }

    @Override
    protected void onInitialize() {
        super.onInitialize();
        this.initComponents();
    }
    
    public void initComponents() {
        this.add(new SearchForm(ComponentIDs.SEARCH_FORM));
    }
        
    /** Identifiers of added components. */
    private static final class ComponentIDs {
        /** Search form. */
        private static final String SEARCH_FORM = "searchForm";
    }
}